<!DOCTYPE html>
<html>

<head>
  <!--谷歌分析工具-->
  <!--https://www.imhunk.com/install-google-webmasters-and-google-analytics/#title1-->
  <meta name="google-site-verification" content="_glN7pkglI6X0zN5WcqtUqWcdsZYrHjodY0N-RU1O08" />
  <title>Dreamy.ai - Chat and connect with AI Companions</title>
  <link rel="canonical" href="http://dreamyai.vip/sign_in.html">
  <meta name="description"
    content="Engage with Dreamy.ai&#39;s virtual companions for immersive and personalized chats. Dive deep into intricate dialogues, and liberate your imagination. Experience adaptive AI-driven role-plays today.">
  <!-- Google tag (gtag.js) -->
  <script async src="https://www.googletagmanager.com/gtag/js?id=G-VEDJEGSS57"></script>
  <script>
    window.dataLayer = window.dataLayer || [];
    function gtag() { dataLayer.push(arguments); }
    gtag('js', new Date());
    gtag('config', 'G-VEDJEGSS57');
  </script>
  <link rel="shortcut icon" href="images/title-icon.png">
  <link rel="canonical" href="https://dreamyai.vip/sign_in.html">
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta property="og:title" content="Dreamy.ai - Chat and connect with AI Companions">
  <meta property="og:type" content="website">
  <meta property="og:url" content="./chart.html">
  <meta property="og:description"
    content="Engage with Dreamy.ai&#39;s virtual companions for immersive and personalized chats. Dive deep into intricate dialogues, and liberate your imagination. Experience adaptive AI-driven role-plays today.">
  <meta property="og:site_name" content="Dreamy.ai - Chat and connect with AI Companions">
  <style type="text/css">
    .turbo-progress-bar {
      position: fixed;
      display: block;
      top: 0;
      left: 0;
      height: 3px;
      background: #0076ff;
      z-index: 2147483647;
      transition:
        width 300ms ease-out,
        opacity 150ms 150ms ease-in;
      transform: translate3d(0, 0, 0);
    }
  </style>
  <script type="text/javascript" async="" src="./js/js"></script>
  <script src="./js/347575881032536" async=""></script>
  <!-- <script async="" src="./js/fbevents.js.下载"></script>
  <script async="" src="./js/gtm.js.下载"></script> -->
  <!-- <script type="text/javascript" async="" src="./js/mixpanel-2-latest.min.js.下载"></script> -->

  <!-- Facebook Open Graph data -->
  <meta property="og:type" content="website">
  <meta property="og:site_name" content="Dreamy.ai - Chat and connect with AI Companions">
  <meta name="viewport" content="width=device-width,initial-scale=1, maximum-scale=1">

  <link rel="stylesheet" href="./js/application-0f3c2308946d2d1b69e62b0c26417ad898bc6b6a6b7857e90524059e7bb67d30.css"
    data-turbo-track="reload">

  <script src="./js/jquery-3.6.0.min.js.下载"></script>
  <script src="./js/checkout.js.下载"></script>
  <script src="https://cdn.bootcss.com/blueimp-md5/2.12.0/js/md5.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.min.js"></script>
  <!-- 引入 Axios -->
  <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
  <script src="./common/request.js"></script>
  <!-- <script src="https://cdn.bootcss.com/blueimp-md5/2.12.0/js/md5.min.js"></script> -->
  <script src="https://accounts.google.com/gsi/client" async defer></script>
  <script src="https://platform.twitter.com/widgets.js"></script>

  <script>
    window.fbAsyncInit = function () {
      FB.init({
        appId: '1316206252400141',
        cookie: true,
        xfbml: true,
        version: 'v12.0'
      });

      FB.AppEvents.logPageView();
    };

    (function (d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) { return; }
      js = d.createElement(s); js.id = id;
      js.src = "https://connect.facebook.net/en_US/sdk.js";
      fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
  </script>
  <script>


    function handleCredentialResponse(response) {
      var credential = response.credential;
      console.log(response)
      axios.post('https://api.dreamyai.vip/oauth/login', { oauth_token: response.credential,type: 'GOOGLE' },).then(result => {
        if (result.data.code == 200) {
          localStorage.setItem('token', result.data.data);
          axios.get("https://api.dreamyai.vip/member/memberDetail", {
            headers: {
              "Authorization": localStorage.getItem('token')
            }
          })
            .then((res) => {
              if (res.data.code == '200' && res.data.data) {
                // console.log("用户信息", res.data);
                if (res.data.data.expirationTime) {
                  new Date(Number(res.data.data.expirationTime)) - new Date() > 0 ? res.data.data.expirationState = 1 : res.data.data.expirationState = 0
                } else {
                  res.data.data.expirationState = 0
                }
                localStorage.setItem('userInfo', JSON.stringify(res.data.data))
                // console.log(res.data.data, 'res.data.datares.data.data')
                window.location.href = './explore.html'
              }

            })
            .catch((err) => {
              console.log(err);
            });
        }
      })
      // 使用credential进行后续操作，例如发送到服务器验证
    }
    function continueWithNextIdp(notification) {
      if (notification.isNotDisplayed() || notification.isSkippedMoment()) {
        // try Next provider if One Tap is not displayed or skipped
      }
    }
    function onSignIn(googleUser) {
      // 处理登录成功的逻辑
      var profile = googleUser.getBasicProfile();
      console.log('ID: ' + profile.getId());
      console.log('Name: ' + profile.getName());
      console.log('Image URL: ' + profile.getImageUrl());
      console.log('Email: ' + profile.getEmail());
    }
    const url = window.location.href;
    const paramsString = url.split('?')[1];
    const params = new URLSearchParams(paramsString);
    const state = params.get('state');
    if (state) {
      axios.post('https://api.dreamyai.vip/oauth/login', { state: params.get('state'), code: params.get('code'),type: params.get('type') },).then(result => {
        if (result.data.code == 200) {
          localStorage.setItem('token', result.data.data);
          axios.get("https://api.dreamyai.vip/member/memberDetail", {
            headers: {
              "Authorization": localStorage.getItem('token')
            }
          })
            .then((res) => {
              if (res.data.code == '200' && res.data.data) {
                // console.log("用户信息", res.data);
                if (res.data.data.expirationTime) {
                  new Date(Number(res.data.data.expirationTime)) - new Date() > 0 ? res.data.data.expirationState = 1 : res.data.data.expirationState = 0
                } else {
                  res.data.data.expirationState = 0
                }
                localStorage.setItem('userInfo', JSON.stringify(res.data.data))
                // console.log(res.data.data, 'res.data.datares.data.data')
                window.location.href = './explore.html'
              }

            })
            .catch((err) => {
              console.log(err);
            });
        }
        console.log(JSON.stringify(res.data))
      })
    }
  </script>
</head>


<body class="bg-main sessions new">


  <div class="flex min-h-full flex-col justify-center py-12 sm:px-6 lg:px-8 bg-neutral-950">
    <div class="sm:mx-auto sm:w-full sm:max-w-md relative z-10">
      <h2 class="mt-6 text-center text-xl font-semibold leading-loose text-white">
        Welcome Back!
      </h2>
      <p class="text-center text-white">Sign in to your account</p>
    </div>
    <div class="p-6 sm:mx-auto sm:w-full sm:max-w-[480px] relative z-10">
      <div class="bg-stone-900 px-6 py-12 shadow rounded-lg sm:px-12 border border-neutral-700">
        <!-- <div id="g_id_onload" data-client_id="380012165420-8pp4r1tt6tkpkll8pa1o19slg5i0s23o.apps.googleusercontent.com"
          data-context="signin" data-ux_mode="popup" data-moment_callback="continueWithNextIdp"
          data-auto_prompt="false">
        </div>

        <div class="g_id_signin" data-type="standard" data-shape="rectangular" data-theme="outline"
          data-text="signin_with" data-size="large" data-logo_alignment="left">
        </div> -->
        <!-- <div id="g_id_onload"  data-client_id="380012165420-8pp4r1tt6tkpkll8pa1o19slg5i0s23o.apps.googleusercontent.com"
          data-callback="handleCredentialResponse">
          <div name="button" type="submit"
            class="inline-flex items-center justify-center w-full bg-white text-sm font-normal border border-gray-300 rounded-md px-4 py-2.5">
            <img alt="Google" class="h-4 w-4 mr-3"
              src="./js/google-auth-a8a364c5c399770d07ce74e6110a120970b1953557a47719692d85ea9334efb6.png">
            <div class="g-signin2" data-onsuccess="onSignIn"
              data-clientid="380012165420-8pp4r1tt6tkpkll8pa1o19slg5i0s23o.apps.googleusercontent.com">Sign in with
              Google</div>

          </div>
        </div> -->
        <div id="fb-root"></div>
        <!-- <script async defer crossorigin="anonymous"
          src="https://connect.facebook.net/zh_CN/sdk.js#xfbml=1&version=v18.0" nonce="kFtO1D6H"></script>
        <div class="fb-login-button" data-width="" data-size="" data-button-type="" data-layout=""
          data-auto-logout-link="false" data-use-continue-as="false"></div>
        <script>
          function loginWithFacebook() {
            FB.login(function (response) {
              if (response.authResponse) {
                // 用户已登录并授权
                console.log('登录成功');
                console.log(response.authResponse.accessToken);
              } else {
                // 用户取消登录或授权失败
                console.log('登录失败');
              }
            }, { scope: 'email' }); // 在这里指定你需要获取的权限，比如获取用户的电子邮件地址
          }
        </script>
        <a href="#" id="twitter-login-button">Login with Twitter</a>
        <script>
          const consumerKey = 'your_consumer_key';
          const callbackUrl = 'http://example.com/callback.html';

          twttr.ready(function () {
            // 创建登录按钮
            const button = document.getElementById('twitter-login-button');
            twttr.widgets.createShareButton(callbackUrl, button, {
              text: 'Login with Twitter',
              hashtags: 'twitter'
            }, function (el) {
              // 绑定登录事件
              el.addEventListener('click', function () {
                // 打开 Twitter 登录窗口
                const authWindow = window.open(`https://api.twitter.com/oauth/authenticate?oauth_token=${requestToken}`, '_blank');

                // 监听登录窗口关闭事件
                window.addEventListener('message', function (event) {
                  if (event.origin === callbackUrl) {
                    // 在此处处理回调并获取用户信息
                    const accessToken = event.data.oauth_token;
                    const accessTokenSecret = event.data.oauth_token_secret;
                    const userId = event.data.user_id;
                    const screenName = event.data.screen_name;

                    // 在此处将用户信息与应用程序关联，并实现登录逻辑
                  }
                });
              });
            });
          });

        </script> -->
        <div id="app">
          <div id="g_id_onload" @click="gogleLik"
            data-client_id="380012165420-8pp4r1tt6tkpkll8pa1o19slg5i0s23o.apps.googleusercontent.com"
            data-callback="handleCredentialResponse">
            <div name="button" type="submit"
              class="inline-flex items-center justify-center w-full bg-white text-sm font-normal border border-gray-300 rounded-md px-4 py-2.5">
              <img alt="Google" class="h-4 w-4 mr-3"
                src="./js/google-auth-a8a364c5c399770d07ce74e6110a120970b1953557a47719692d85ea9334efb6.png">
              <div class="g-signin2" data-onsuccess="onSignIn"
                data-clientid="380012165420-8pp4r1tt6tkpkll8pa1o19slg5i0s23o.apps.googleusercontent.com">Sign in with
                Google</div>

            </div>
          </div>
          <div id="g_id_onload" style="margin-top: 10px;" @click="faceLik"
            data-client_id="380012165420-8pp4r1tt6tkpkll8pa1o19slg5i0s23o.apps.googleusercontent.com"
            data-callback="handleCredentialResponse">
            <div name="button" type="submit"
              class="inline-flex items-center justify-center w-full bg-white text-sm font-normal border border-gray-300 rounded-md px-4 py-2.5">
              <img alt="Google" class="h-4 w-4 mr-3"
                src="./images/facebook.png">
              <div class="g-signin2" data-onsuccess="onSignIn"
                data-clientid="380012165420-8pp4r1tt6tkpkll8pa1o19slg5i0s23o.apps.googleusercontent.com">Sign in with
                Facebook</div>

            </div>
          </div>
          <!-- <div class="flex items-center justify-between mt-5">
            <hr class="border-white w-1/3">
            <span class="text-white text-sm font-medium px-3">OR</span>
            <hr class="border-white w-1/3">
          </div> -->
 
          <div class="simple_form mt-5" id="new_user" accept-charset="UTF-8">

            <div class="form-inputs mb-3">
              <div class="w-full flex-col justify-start items-start gap-1.5 inline-flex">
                <div class="self-stretch flex-col justify-start items-start gap-1.5 flex relative">
                  <div class="w-5 h-5 absolute top-[13px] left-[10px]">
                    <img src="./images/icon_email.svg" alt="">
                  </div>
                  <div class="input email required user_email w-full"><input
                      class="string email required w-full self-stretch pl-10 px-3.5 py-2.5 rounded-lg shadow border border-[#363636] justify-start items-center gap-2 inline-flex text-white bg-stone-900"
                      required="required" aria-required="true" placeholder="Email" type="email" v-model='emailText'
                      name="user[email]" id="user_email" data-gtm-form-interact-field-id="0"></div>
                </div>
              </div>
              <div class="w-full flex-col justify-start items-start gap-1.5 inline-flex mt-5">
                <div class="self-stretch flex-col justify-start items-start gap-1.5 flex relative">
                  <div class="w-5 h-5 absolute top-[13px] left-[10px]">
                    <img src="./images/icon_seeting.svg">
                  </div>
                  <div class="w-5 h-5 absolute top-[13px] right-[10px]">
                    <img src="./images/icon_eye.svg"
                      @click='inputType === "password"? inputType ="text": inputType = "password"'
                      class="password-toggle-icon cursor-pointer">
                  </div>
                  <div class="input password required user_password w-full"><input
                      class="password required w-full self-stretch pl-10 px-3.5 py-2.5 rounded-lg shadow border border-[#363636] justify-start items-center gap-2 inline-flex text-white bg-stone-900"
                      v-model='emailPwd' required="required" aria-required="true" placeholder="Password"
                      :type="inputType" name="user[password]" id="user_password" data-gtm-form-interact-field-id="1">
                  </div>
                </div>
              </div>
            </div>
            <a class="text-white mb-4 font-medium text-sm underline" href="./new.html">Forgot
              your password?</a><br>
            <div style="cursor: pointer;"
              class="w-full mt-4 px-4 py-3 bg-[#E75275] rounded-[10px] border border-[#E75275] justify-center items-center gap-2 inline-flex text-white"
              id="signup-btn" @click='signBtn'>
              sign In
            </div>
          </div>
          <div class="mt-5" style="width: 100%; height: 0px; opacity: 0.20; border: 0.50px white solid"></div>
          <div class="flex mt-5 font-light text-sm justify-center items-center gap-2 inline-flex text-white">
            Don't have an account yet?
            <a href="./sign_up.html" class="text-[#E75275] text-sm font-semibold leading-normal"> Sign
              up</a>
          </div>
        </div>
      </div>
    </div>
  </div>

  <div class="w-full h-[56px] fixed bottom-0 bg-neutral-950 background-gradient z-20 block lg:hidden">
    <div class="flex p-[15px] justify-between">
      <!-- Discover Icon -->
      <a href="./explore.html">
        <img src="./images/explore.png" style="width: 24px">
      </a>
      <!-- My AI Icon -->
      <a href="./myai.html" class="relative">
        <img src="./images/myai.png" style="width: 24px">
      </a>
      <!-- Create AI Icon -->
      <a href="./create1.html" class="relative">
        <img src="./images/create.png">
      </a>
      <!-- Chat Icon -->
      <a href="./chart.html">
        <img src="./images/chat.png" style="width: 24px">
      </a>


    </div>
  </div>


</body>

</html>
<script>
  window.onload = function () {
    var app = new Vue({
      el: '#app',
      data() {
        return {
          emailText: '',
          emailPwd: '',
          inputType: 'password'
        }
      },

      mounted() {
        console.log('loginInloginIn')

      },
      methods: {
        faceLik() {
          instance.get("/oauth/authorizingUrl", {
            params: { type: 'FACEBOOK'   }

          }).then(res => {
            if (res.data.code == 200) {
              location.href = res.data.data
            }
          })
        },
        gogleLik() {
          instance.get("/oauth/authorizingUrl", {
            params: { type: 'GOOGLE'   }
            
          }).then(res => {
            if (res.data.code == 200) {
              location.href = res.data.data
            }
          })
        },
        signBtn() {
          console.log('登陆')
          if (!this.emailText || !this.emailPwd) {
            alert('请输入必填项')
            return
          }
          if (this.emailPwd.length >= 6 && this.emailPwd.length <= 18) {
            if (this.emailText && this.emailPwd) {
              // console.log(this.emailText, this.emailPwd)
              instance.post("/member/login", {
                email: this.emailText,
                passWord: md5(this.emailPwd),
                type: 'GOOGLE'
                // passWord: this.emailPwd
              })
                .then((result) => {
                  console.log(result.data);
                  if (result.data) {
                    localStorage.setItem('token', result.data.data)
                    // result.data.id = result.data.traceId
                    instance.get("/member/memberDetail")
                      .then((res) => {
                        if (res.data.code == '200' && res.data.data) {
                          // console.log("用户信息", res.data);
                          if (res.data.data.expirationTime) {
                            new Date(Number(res.data.data.expirationTime)) - new Date() > 0 ? res.data.data.expirationState = 1 : res.data.data.expirationState = 0
                          } else {
                            res.data.data.expirationState = 0
                          }
                          localStorage.setItem('userInfo', JSON.stringify(res.data.data))
                          // console.log(res.data.data, 'res.data.datares.data.data')
                          window.location.href = './explore.html'
                        }

                      })
                      .catch((err) => {
                        console.log(err);
                      });
                  }
                })
                .catch((err) => {
                  // console.log(err);
                });
            }
          } else {
            alert('Incorrect password format')
          }

        }
      }
    })
  }
</script>